<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加商品</title>
<!-- 引入Jquery -->
<script type="text/javascript"
	src="${APP_PATH}/static/js/jquery-2.1.1.min.js"></script>

<style type="text/css">
.tabl td {
	font-size: 16px;
	font-weight: bold;
}

.tabl {
	height: 460px;
}

.tabl td input {
	height: 30px;
	width: 260px;
	border-radius: 4px;
	font-size: 14px;
}

.tabl .sele {
	height: 36px;
	width: 260px;
	border-radius: 4px;
}
</style>
<script type="text/javascript">
	function ret() {
		window.location.href = "${pageContext.request.contextPath}/admin/adminProduct_findAllByPage.action?page=1";
	}

	$(document).on("click", ".sav", function() {
		alert("添加完成！！！");
	});

	function checkForm() {
		var pname = document.getElementById("pname").value;
		var shopPrice = document.getElementById("shopPrice").value;
		var marketPrice = document.getElementById("marketPrice").value;
		var pdesc = document.getElementById("pdesc").value;
		if (pname == null || pname == '') {
			alert("商品名称不能为空");
			window.location.reload();
			//return false;
		}
		/* if else (shopPrice == null || shopPrice == '') {
			alert("市场价格不能为空");
			return false;
		}
		if else(marketPrice == null || marketPrice == '') {
			alert("销售价格不能为空");
			return false;
		}
		else (pdesc == null || pdesc == '') {
			alert("商品描述不能为空");
			return false;
		} */
		//return true;
		window.location.href = "${pageContext.request.contextPath}/admin/adminProduct_save.action";
	}
</script>
</head>
<body>
	<div>
		<div class="b" style="float: left; padding-left: 30px;">
			<h2>添加商品</h2>
		</div>
		<div align="right" style="padding-right: 60px; padding-top: 20px;">
			<input type="button" onclick="history.go(-1)" value="返回"
				style="width: 74px; height: 40px; background-color: #0f83c7; color: white; margin-left: 800px;"
				align="right" />
		</div>
	</div>
	<hr
		style="height: 1px; border: none; border-top: 1px solid #555555; width: 95%" />
	<div style="margin-left: 60px;" class="formm">
		<form id="userAction_save_do" name="Form1"
			action="${pageContext.request.contextPath}/admin/adminProduct_save.action"
			method="post" enctype="multipart/form-data">
			<table class="tabl">
				<tr>
					<td style="text-align: right;">商品名称：</td>
					<td width="20"></td>
					<td><input type="text" name="pname"
						id="userAction_save_do_logonName" placeholder="请输入商品名称" /></td>
				</tr>
				<tr>
					<td>是否热门：</td>
					<td width="20"></td>
					<td><select name="isHot" class="sele">
							<option value="1">是</option>
							<option value="0">否</option>
					</select></td>
				</tr>
				<tr>
					<td>市场价格：</td>
					<td width="20"></td>
					<td><input type="text" name="marketPrice" value=""
						id="userAction_save_do_logonName" class="bg" placeholder="请输入市场价格" /></td>
				</tr>
				<tr>
					<td>销售价格：</td>
					<td width="20"></td>
					<td><input type="text" name="shopPrice" value=""
						id="userAction_save_do_logonName" class="bg" placeholder="请输入销售价格" /></td>
				</tr>
				<tr>
					<td>商品图片：</td>
					<td width="20"></td>
					<td><input type="file" name="file" /></td>

				</tr>
				<tr>
					<td>二级分类：</td>
					<td width="20"></td>
					<td><select name="csid" class="sele">
							<c:forEach items="${cslist}" var="cs">
								<option value="${cs.csid}">${cs.csname}</option>
							</c:forEach>
					</select></td>
				</tr>
				<tr>
					<td>商品描述：</td>
					<td width="20"></td>
					<td><textarea name="pdesc" rows="5" cols="35"></textarea></td>
				</tr>

				<tr>
					<td align="right"><button type="reset" value="重置"
							style="width: 70px; height: 38px; background-color: #0f83c7; color: white;">&#37325;&#32622;</button></td>
					<td></td>
					<td align="center">
						<button type="submit" id="userAction_save_do_submit" value="提交"
							class="submit_btn sav" onclick="checkForm()"
							style="width: 70px; height: 38px; background-color: #0f83c7; color: white;">&#30830;&#23450;</button>
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>

